package Test;

import dao.Ink;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.awt.*;

public class Greylnk implements Ink {

    @Override
    public String getColor(int red, int green, int blue) {
        int c = (red + green + blue)/3;
        Color color = new Color(c, c, c);
        return "#"+Integer.toHexString(color.getRGB()).substring(2);
    }
    @Test
    public void printerTest() {
        ApplicationContext context=new ClassPathXmlApplicationContext("applicationContext1.xml");
        Printer printer=(Printer)context.getBean("printer");
        String content="叠个千纸鹤，再系个红飘带，\n" +
                "愿善良的人们天天好运来。\n" +
                "你勤劳生活美，你健康春常在，\n" +
                "你一生的忙碌为了笑逐颜开。\n" +
                "打个中国结，请春风剪个彩，\n" +
                "愿祖国的日月年年好运来。\n" +
                "你凤舞太平年，你龙腾新时代，\n" +
                "你幸福的家园迎来百花盛开。\n" +
                "好运来，祝你好运来，\n" +
                "好运带来了喜和爱。\n" +
                "好运来，我们好运来，\n" +
                "迎着好运兴旺发达通四海。\n" +
                "叠个千纸鹤，再系个红飘带，\n" +
                "愿善良的人们天天好运来。\n" +
                "你勤劳生活美，你健康春常在，\n" +
                "你一生的忙碌为了笑逐颜开。\n" +
                "打个中国结，请春风剪个彩，\n" +
                "愿祖国的日月年年好运来。\n" +
                "你凤舞太平年，你龙腾新时代，\n" +
                "你幸福的家园迎来百花盛开。\n" +
                "好运来，祝你好运来，\n" +
                "好运带来了喜和爱。\n" +
                "好运来，我们好运来，\n" +
                "迎着好运兴旺发达通四海。\n" +
                "好运来，祝你好运来，\n" +
                "好运带来了喜和爱。\n" +
                "好运来，我们好运来，\n" +
                "迎着好运兴旺发达通四海，通四海，好运来。";
                printer.Print(content);
    }
}
